home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Supervisor's Toolkit
/
Network Supervisor's Toolkit.iso
/
tools
/
lu62
/
port
/
resid.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-07-10
|
7KB
|
262 lines
/* @0203 05/09/91 *//* delete pparm */
/* @0206 06/09/91 *//* videobuf */
/* @0207 06/09/91 *//* videobuf */
/* @0209 07/09/91 *//* videobuf */
/* @0215 14/09/91 *//* Bufvt & overlay */
/* @0224 20/09/91 *//* BSS */
/* k 0233 12/10/91 *//* Trn modules */
/* k 0234 14/10/91 *//* OVL_TYPE */
/* k 0246 22/10/91 *//* FP_OFF */
/*#define DEBUG*/
#include <ebss.h>
#include <alloc.h>
#if (OS_TYPE==0)
#include <portparm.h>
#define FP_OFF(fp) ((unsigned)(fp)) /* @0246 */
#define FP_SEG(fp) ((unsigned)((unsigned long)(fp) >> 16))
#define MK_FP(seg,ofs) ((void far *) \
(((unsigned long)(seg) << 16) | (unsigned)(ofs)))
#else
#include <mortparm.h>
#endif
void initcolortable();
void initcursor();
#if (OS_TYPE == 0) /* @0207 */
#else /* @0207 */
extern char far *videobuf; /* @0206 */
#endif /* @0207 */
unsigned int igetcursor();
resid ( ) {
#if (OS_TYPE==0)
#if !defined (DEBUG)
unsigned x=getpsp(), y;
void * last;
#endif
#endif
if (optflg & VT_OPT) /* @0203 */
initcursor();
if (optflg & EM_OPT) /* @0203 */
{
initcolortable();
initcolors ( );
}
#if (OS_TYPE==0)
bufvt2580.cursor_size=NOCURSOR; /* @0215 */
bufvt2580.winleft=1; /* @0215 */
bufvt2580.wintop=3; /* @0215 */
bufvt2580.winright=80; /* @0215 */
bufvt2580.winbottom=23; /* @0215 */
bufvt2580.curx=1; /* @0215 */
bufvt2580.cury=1; /* @0215 */
#if !defined (DEBUG) /* @0185 */
last= malloc (1);
y=FP_SEG (last);
y+=1;
modsegment=x+16; /* OVERLAY */
ovlsegment=FP_SEG (res_area);
if (FP_OFF (res_area) != 0) ovlsegment++;
newsegment=ovlsegment; /* one overlay area */ /* OVERLAY */
{
int i,j;
struct tran_ovl *TOVL=transit;
for (j=0;j<OVERNUM;j++) {
union ovl_text * OVLT;
OVLT= (union ovl_text *) TOVL->Func;
for (i=0;i<TOVL->number_of_func;i++) {
OVLT->i.f.fa.s+=ovlsegment;
OVLT++;
};
TOVL++;
}
}
ovl_area=MK_FP (ovlsegment,0); /* OVERLAY */
inst (x,y);
}
#else
rdos=&rentdos; /* @0209 */
router ( );
}
#endif
#endif
void initcursor() /* @0184 */
/* Initializes the different cursor types */
{
#if (OS_TYPE==4)
int selector,fd;
char * device;
int video;
video=ioctl (0,CONS_CURRENT,0); /* @0189 */
switch(video) {
case VGA:
adaptMAP=MAPVGA; /* @0184 */
adaptIO=VGAIO;
adaptMD=SW_VGA80x25;
device="/dev/vga";
nocursor=0x0100;
shortcursor=0x0A0C;
tallcursor = 0x090C;
break; /* @0189 */
case PGA:
adaptMAP=MAPPGA; /* @0184 */
adaptIO=PGAIO;
adaptMD=SW_ENHC80x25;
device="/dev/pga";
nocursor=0x0100;
shortcursor=0x0A0C;
tallcursor = 0x090C;
break; /* @0189 */
case EGA:
adaptMAP=MAPEGA; /* @0184 */
adaptIO=EGAIO;
adaptMD=SW_ENHC80x25;
device="/dev/ega";
nocursor=0x0100;
shortcursor=0x0A0C;
tallcursor = 0x090C;
break;
case CGA:
adaptMAP=MAPCGA; /* @0184 */
adaptIO=CGAIO;
adaptMD=SW_C80x25;
device="/dev/color";
nocursor=0x0100;
shortcursor=0x0607;
tallcursor = 0x0507;
break;
case MONO:
adaptMAP=MAPMONO; /* @0184 */
adaptIO=MCAIO;
adaptMD=SW_MCAMODE;
device="/dev/monochrome";
nocursor=0x0100;
shortcursor=0x0A0C;
tallcursor = 0x090C;
}
ioctl (0,adaptMD,0);
fd=open(device,O_RDWR);
selector=ioctl(fd,adaptMAP,0);
videobuf=(char far *)selector; /* @0189 */
/* videobuf=sotofar(selector,0); */
#endif
#if (OS_TYPE==3)
nocursor=0x0100;
#endif
#if (OS_TYPE==0) /* @0215 */
if (!icheck_mode( )) /* MONO */ /* @0215 */
#else /* @0215 */
if (!check_mode( )) /* MONO */ /* @0215 */
#endif /* @0215 */
{
#if (OS_TYPE!=4)
shortcursor=0x0A0C;
tallcursor = 0x090C;
videobuf=(char *)0xb0000000; /* @0209 */
#endif
vissegment=0xB000;
baseport=0x3B4;
}
else
{
#if (OS_TYPE!=4)
shortcursor = 0x0607;
tallcursor = 0x0507;
videobuf=(char *)0xb8000000; /* @0209 */
#endif
vissegment=0xB800;
baseport=0x3D4;
}
#if ((OS_TYPE!=3)&&(OS_TYPE!=4))
oldcursor = igetcursor(); /* @0215 */
#else
oldcursor = shortcursor;
#endif
/* @0209 */
} /* initcursor */
void initcolortable() /* @0184 */
/* Sets up the color table */
{
int color, fg, bg, fcolor, bcolor;
#if (OS_TYPE==0) /* @0215 */
if (icheck_mode ( ) ) /* @0215 */
#else /* @0215 */
if (check_mode ( ) ) /* @0215 */
#endif /* @0215 */
{
for (color = 0; color <= 255; color++)
colortable[color] = color;
}
else
{
for (fg = BLACK; fg <= WHITE; fg++)
{
if (fg == BLACK)
fcolor = BLACK;
else if (fg <= LIGHTGRAY)
fcolor = LIGHTGRAY;
else
fcolor = WHITE;
for (bg = BLACK; bg <= LIGHTGRAY; bg++)
{
if (bg == BLACK)
bcolor = BLACK;
else
{
if (fcolor == WHITE)
fcolor = BLACK;
bcolor = LIGHTGRAY;
}
colortable[fg + (bg << 4)] = fcolor + (bcolor << 4);
}
}
for (fg = 128; fg <= 255; fg++)
colortable[fg] = colortable[fg - 128] | 0x80;
}
} /* initcolortable */
initcolors ( ) {
ind_y=25;
enable_x1=8;
enable_x2=17;
insert_x=26;
mix=&screen[0].icon;
attrib[0]=BLACK*16+LIGHTGRAY;
attrib[1]=BLACK*16+LIGHTGRAY+BLINK;
attrib[2]=BLACK*16+LIGHTGRAY;
attrib[3]=BLACK*16+LIGHTGRAY+BLINK;
attrib[4]=BLACK*16+WHITE;
attrib[5]=BLACK*16+WHITE+BLINK;
attrib[6]=BLACK*16+BLACK;
attrib[7]=BLACK*16+BLACK;
attrib[8]=BLACK*16+GREEN;
attrib[9]=BLACK*16+GREEN+BLINK;
attrib[10]=BLACK*16+GREEN;
attrib[11]=BLACK*16+GREEN+BLINK;
attrib[12]=BLACK*16+LIGHTGREEN;
attrib[13]=BLACK*16+LIGHTGREEN+BLINK;
attrib[14]=BLACK*16+BLACK;
attrib[15]=BLACK*16+BLACK;
}
#if (OS_TYPE==0) /* @0215 */
int icheck_mode ( ) { /* @0215 */
union REGS reg;
/* @0233 */
reg.h.ah = 15;
int86(0X10, ®, ®);
if (reg.h.al==7) return 0;
return 1;
} /* @0215 */
unsigned int igetcursor() /* @0215 */
/* Returns the shape of the current cursor */ /* @0215 */
{ /* @0215 */
union REGS reg; /* @0215 */
/* @0215 */
reg.h.ah = 3; /* @0215 */
reg.h.bh = 0; /* @0215 */
int86(0X10, ®, ®); /* @0215 */
return(reg.x.cx); /* @0215 */
} /* @0215 */
#endif /* @0215 */